package com.example.a4;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.content.*;
/**
 * Created by 俊辉 on 2018/4/13.
 */

public class otherActivity extends Activity{
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.other);
        Bundle bundle=this.getIntent().getExtras();
        String ans=bundle.getString("ans");
        TextView tv=(TextView) findViewById(R.id.ans);
        if(ans.equals("in")){
            tv.setText("Your answer is"+ans+"! It's Correct!");
        }
        else{
            tv.setText("Your answer is"+ans+"! It's Wrong!");
        }
        Button btn_back=(Button) findViewById(R.id.back);
        btn_back.setOnClickListener(new Button.OnClickListener() {
            @Override
            public void onClick(View v) {
                otherActivity.this.setResult(RESULT_OK,new Intent());
                otherActivity.this.finish();
            }
        });
    }
}
